# $Id: PKGBUILD 87510 2013-04-02 00:31:11Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=ubuntu-sso-client
pkgver=4.2.0
pkgrel=1
pkgdesc="Desktop service to allow applications to sign into Ubuntu services via SSO"
arch=('any')
url="https://launchpad.net/ubuntu-sso-client"
license=('GPL')
depends=('python2-dbus' 'python2-pyqt' 'python2-dirspec' 'python2-httplib2' 'python2-oauthlib' 'python2-pyopenssl' 'python2-imaging' 'twisted' 'gnome-keyring' 'gsettings-desktop-schemas')
makedepends=('python2-distutils-extra')
replaces=('ubuntu-sso-client-gtk' 'ubuntu-sso-client-qt')
provides=('ubuntu-sso-client-gtk' 'ubuntu-sso-client-qt')
source=(https://launchpad.net/$pkgname/stable-4-2/$pkgver/+download/$pkgname-$pkgver.tar.gz
        oauthlib-0.3.8.patch)
md5sums=('1e80d1702ee69cf63242aafaa2c0cc00'
         'dfe190f84a8468cff995595fa38a6370')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # Python2 fix
  sed -i 's@^#!.*python$@#!/usr/bin/python2@' bin/*

  # Fix error with oautlib>=0.3.8
  patch -Np1 -i "$srcdir/oauthlib-0.3.8.patch"

  python2 setup.py build
}

package() {

  cd "$srcdir/$pkgname-$pkgver"

  python2 setup.py install --root=$pkgdir/ --optimize=1

  # Remove unneeded files
  rm "$pkgdir"/usr/share/ubuntu-sso-client/*.ttf
}
